package com.hydong.novatest.base

import android.content.Context
import android.os.Bundle
import android.view.View
import com.hydong.novatest.fragment.HomeFragment
import com.qmuiteam.qmui.arch.QMUIFragment
import com.qmuiteam.qmui.arch.SwipeBackLayout
import com.qmuiteam.qmui.util.QMUIDisplayHelper

abstract class BaseFragment : QMUIFragment() {

    open fun BaseFragment() {}

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
    }

    override fun backViewInitOffset(context: Context?, dragDirection: Int, moveEdge: Int): Int {
        return if (moveEdge == SwipeBackLayout.EDGE_TOP || moveEdge == SwipeBackLayout.EDGE_BOTTOM) {
            0
        } else QMUIDisplayHelper.dp2px(context, 100)
    }

    override fun onLastFragmentFinish(): Any? {
        return HomeFragment()
    }
}